package com.travel.controller.admin;

import com.travel.entity.dto.LoginRequestDTO;
import com.travel.entity.vo.LoginResponseVo;
import com.travel.result.Result;
import com.travel.service.AdminService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;

@Api(tags = "管理员接口")
@RestController
@RequestMapping("/admin")
@CrossOrigin
public class AdminController {

    private final AdminService adminService;

    public AdminController(AdminService adminService) {
        this.adminService = adminService;
    }

    @ApiOperation("管理员登录")
    @PostMapping("/login")
    public Result<LoginResponseVo> login(@Valid @RequestBody LoginRequestDTO loginRequestDTO) {
        LoginResponseVo loginResponseVo = adminService.login(loginRequestDTO);
        return Result.success(loginResponseVo);
    }

} 